package com.soufang.soufangdemo.base;

/**
 * 统一响应错误枚举
 */
public enum Status {
    /**
     * 获取到正确响应
     */
    OK(0, "OK"),
    /**
     * 错误的请求
     */
    BAD_REQUEST(400, "Bad Request"),
    /**
     * 未找到资源
     */
    NOT_FOUND(404, "Not Found"),
    /**
     * 服务器内部错误，一般而言是服务器代码未被处理的错误
     */
    INTERNAL_SERVER_ERROR(500, "Internal Server Error"),
    /**
     * 业务错误
     */
    CITY_NOT_FOUND(1001, "City Not Found"),

    INVALID_USERNAME_OR_PASSWORD(1002, "用户名或密码错误");

    /**
     * 错误码
     */
    private final int value;

    /**
     * 错误信息
     */
    private final String reasonPhrase;

    Status(int value, String reasonPhrase) {
        this.value = value;
        this.reasonPhrase = reasonPhrase;
    }

    public int value() {
        return this.value;
    }

    public String getReasonPhrase() {
        return reasonPhrase;
    }
}
